package RedisDay1;

import redis.clients.jedis.Jedis;

public class Demo2 {
    public static void main(String[] args) {
        Jedis master = null;
       try{
           //连接数据库
          master  = new Jedis("192.168.111.166", 7000);
          //测试连接
           if(master.ping().equals("PONG")){
               System.out.println("连接成功！");
               //读取数据库文件
               System.out.println(master.lrange("listname", 0, -1));
           }
       }catch (Exception e){
           e.printStackTrace();
       }finally {
           if(master!=null)
               master.close();
       }
    }
}